<?php
use tpfcore\Core;
?>
<!doctype html>
<html>
	<head>
		<meta charset="utf-8">
		<!-- Set render engine for 360 browser -->
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<!-- HTML5 shim for IE8 support of HTML5 elements -->
		<!--[if lt IE 9]>
			<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js">
			</script>
		<![endif]-->
		<link href="{$admin_assets_path}/css/theme.min.css" rel="stylesheet">
		<link href="{$admin_assets_path}/css/simplebootadmin.css" rel="stylesheet">
		<link href="{$admin_assets_path}/css/default.css" rel="stylesheet" />
		<link href="{$admin_assets_path}/css/font-awesome.min.css"
		rel="stylesheet" type="text/css">
		<style>
			.length_3{width: 180px;} form .input-order{margin-bottom: 0px;padding:3px;width:40px;}
			.table-actions{margin-top: 5px; margin-bottom: 5px;padding:0px;} .table-list{margin-bottom:
			0px;}
		</style>
		<!--[if IE 7]>
			<link rel="stylesheet" href="{$admin_assets_path}/css/font-awesome-ie7.min.css">
		<![endif]-->
		<script type="text/javascript">
			//全局变量
			var GV = {
				WEB_ROOT:"",
				DIMAUB: "/",
				JS_ROOT: "/theme/backend/assets/js/",
				TOKEN: ""
			};
		</script>
		<!-- Le javascript==================================================-
		-> <!-- Placed at the end of the document so the pages load faster -->
		<script src="{$admin_assets_path}/js/jquery.js"></script>
		<script src="{$admin_assets_path}/js/wind.js"></script>
		<script src="{$admin_assets_path}/js/bootstrap.min.js"></script>
	</head>
	<body>
		<div class="wrap">
		<ul class="nav nav-tabs">
			<li class="active"><a href="#A" data-toggle="tab">消息推送配置</a></li>
			<li><a href="#B" data-toggle="tab">微信开发者ID</a></li>
			<li><a href="#C" data-toggle="tab">百度开发者ID</a></li>
			<li><a href="#D" data-toggle="tab">接口配置</a></li>
		</ul>
		<form method="post" class="form-horizontal js-ajax-form" action="">
			<fieldset>
				<div class="tabbable">
					<div class="tab-content">
						<div class="tab-pane active" id="A">
							<div class="admin-tips">
				                <font class="red">注意：</font>如下参数为你配置好的“<a href="https://mp.weixin.qq.com/wxopen/devprofile?action=get_callback&token=1425804834&lang=zh_CN">消息推送配置</a>”参数，倘若你还没有配置，请登录你的小程序进行配置“<a href="https://mp.weixin.qq.com/wxopen/devprofile?action=get_callback&token=1425804834&lang=zh_CN">消息推送配置</a>”
				            </div>
							<fieldset>
							<div class="control-group">
								<label class="control-label">URL(服务器地址):</label>
								<div class="controls">
									<input type="text" name="url" value="{$list.url}">
									<span class="form-required">* 必须以http://或https://开头，分别支持80端口和443端口</span>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">Token(令牌):</label>
								<div class="controls">
									<input type="text" name="token" value="{$list.token}">
									<span class="form-required">* 必须为英文或数字，长度为3-32字符</span>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">EncodingAESKey(消息加密密钥)随机生成:</label>
								<div class="controls">
									<input type="text" name="encodingAESKey" value="{$list.encodingAESKey}">
									<span class="form-required">* 消息加密密钥由43位字符组成，字符范围为A-Z,a-z,0-9</span>
								</div>
							</div>
							</fieldset>
						</div>
						<div class="tab-pane" id="B">
							<div class="admin-tips">
				                <font class="red">注意：</font>参数请登录微信小程序官方后台进行查看
				            </div>
							<fieldset>
							<div class="control-group">
								<label class="control-label">AppID(小程序ID):</label>
								<div class="controls">
									<input type="text" name="appid" value="{$list.appid|default=''}">
									<span class="form-required">* 小程序AppID(小程序ID)</span>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">AppSecret(小程序密钥)	:</label>
								<div class="controls">
									<input type="text" name="secret" value="{$list.secret|default=''}">
									<span class="form-required">* AppSecret(小程序密钥)</span>
								</div>
							</div>
							</fieldset>
						</div>
						<div class="tab-pane" id="C">
							<div class="admin-tips">
				                <font class="red">注意：</font>参数请登录百度小程序官方后台进行查看
				            </div>
							<fieldset>
							<div class="control-group">
								<label class="control-label">AppID(小程序ID):</label>
								<div class="controls">
									<input type="text" name="bd_appid" value="{$list.bd_appid|default=''}">
									<span class="form-required">* 百度小程序AppID(小程序ID)</span>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">AppSecret(小程序密钥)	:</label>
								<div class="controls">
									<input type="text" name="bd_secret" value="{$list.bd_secret|default=''}">
									<span class="form-required">* 百度AppSecret(小程序密钥)</span>
								</div>
							</div>
							</fieldset>
						</div>
						<div class="tab-pane" id="D">
							<div class="admin-tips">
				                <font class="red">注意：</font>接口key配置在微信端后，禁止再次修改，否则会出现接口访问不了的问题，<span class="red">生成好后请在小程序里面配置后再上传小程序到微信服务器</span>
				            </div>
							<fieldset>
							<div class="control-group">
								<label class="control-label">接口访问安全验证:</label>
								<div class="controls">
									<label><input type="radio" name="mini_api_validate" value="1" {eq name="list.mini_api_validate" value="1" }checked{/eq}>验证</label>
									<label><input type="radio" name="mini_api_validate" value="0" {eq name="list.mini_api_validate" value="0" }checked{/eq}>不验证</label>
									<span class="form-required red">* 建议开启，防止别人非法访问你的接口，该选项针对小程序</span>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">接口IP白名单:</label>
								<div class="controls">
									<textarea name="api_ip_authorize" style="width:380px;height: 100px;">{$list.api_ip_authorize|default=''}</textarea>
									<span class="form-required red">* 为空表示不验证，多个ip通过换行配置，该配置针对web有效</span>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">接口访问时限:</label>
								<div class="controls">
									<input type="text" name="api_time_limit" value="{$list.api_time_limit|default=0}" style="width: 280px;">
									<span class="form-required red">* 接口请求时长，超过该时间，接口链接将失效，须要重新发起请求，单位秒(s)</span>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">接口key(apiKey):</label>
								<div class="controls">
									<input type="text" id="apiKey" name="apiKey" value="{$list.apiKey|default=''}" style="width: 280px;">
									<input type="button" class="btn btn-success rand-key" value="随机生成">
									<span class="form-required red">* 小程序已配置后，请慎重修改,长度8-64位，可包含字母、数字</span>
								</div>
							</div>
							</fieldset>
						</div>
					</div>
				</div>
			</fieldset>
			<div class="form-actions">
				<button type="submit" class="btn btn-primary js-ajax-submit">确定操作</button>
				<a class="btn" href="javascript:history.go(-1);">返回</a>
			</div>
		</form>
	</div>
		<script src="{$admin_assets_path}/js/common.js"></script>
		<script type="text/javascript">
		$(function(){
			$(".rand-key").click(function(){
				$.ajax({
					type:"post",
					dataType:"json",
					url:"{:url('cms/cms/getRandString')}",
					data:{"t":(new Date()).getTime()},
					success:function(data){
						if(data.code==0) $("#apiKey").val(data.data);
					}
				});
			});
		});
		</script>
	</body>

</html>